package com.zs.leymovie.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.zs.leymovie.MainActivity;
import com.zs.leymovie.R;

/**
 * Created by Administrator on 2015/7/27 0027.
 */
public class WelcomeFragment extends Fragment {
    private int index;

    public WelcomeFragment() {
    }

    public WelcomeFragment(int index) {
        this.index = index;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_bg_fg_one, container, false);
        ImageView imageView = (ImageView) view.findViewById(R.id.bg_fg_one_img);
        switch (index) {
            case 1:
                imageView.setImageResource(R.mipmap.help1);
                break;
            case 2:
                imageView.setImageResource(R.mipmap.help2);
                break;
            case 3:
                imageView.setImageResource(R.mipmap.help3);
                break;
            case 4:
                imageView.setImageResource(R.mipmap.help4);
                imageView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), MainActivity.class);
                        getActivity().startActivity(intent);
                    }
                });
                break;
        }
        return view;
    }
}
